var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs: ['待审核', '已通过'],
    tabIndex: 0,
    navigator: { hide: 0 },
    list: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that =this;
    that.setData({
      shop_id: options.id
    })
    that.getlist()
  },
  onShow: function () {
    
  },
  getlist:function(e){
    let that = this;
    wx.showLoading({
      title: '加载中…',
    })
    app.ihttpGet('https://www.58zltc.com/api.php/Shop/getIntOrder/openid/' + app.globalData.openid + "/shop_id/" + that.data.shop_id, function (res) {
      that.setData({
        list: res.data
      })
    })
  },

  setTab: function(e){
    this.setData({
      tabIndex: e.currentTarget.dataset.index
    })
  },
  backto: function () {
    wx.navigateBack({
      
    })
  },
  adopt: function (e) {
    var that = this
    var order_id = e.currentTarget.dataset.order_id
    app.ihttpGet('https://www.58zltc.com/api.php/Shop/adoptIntOrder/orderid/' + order_id, function (res) {
      var icon = 'none'
      res.data.error == 0 ? icon = 'success' : ''
      wx.showToast({
        title: res.data.msg,
        icon: icon,
        duration: 1200
      })
      setTimeout(function () {
        that.getlist()
      }, 1200)
    })
  }
})